home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 25
/
Mac Magazin and MacEasy Magazine CD - Issue 25.iso
/
Grafik & Text
/
Alpha
/
Tcl
/
Modes
/
adaMode.tcl
next >
Wrap
Text File
|
1996-08-15
|
3KB
|
103 lines
if {$startingUp} {
addMode Ada dummyAda {*.ada *.ads *.adb *.ADS *.ADB *_.a *.a } {}
return
}
#===============================================================================
# From Raymond Waldrop <rwaldrop@cs.tamu.edu>
#===============================================================================
newModeVar Ada elecRBrace {1} 1
newModeVar Ada leftFillColumn {3} 0
newModeVar Ada prefixString {-- } 0
newModeVar Ada electricSemi {1} 1
newModeVar Ada wordBreak {[a-zA-Z0-9_]+} 0
newModeVar Ada elecLBrace {1} 1
newModeVar Ada wordWrap {0} 1
newModeVar Ada funcExpr {^[ \t]*(procedure|function)[ \t]+([A-Za-z][A-Za-z0-9_]*)} 0
newModeVar Ada wordBreakPreface {[^a-zA-Z0-9_]} 0
newModeVar Ada electricTab {0} 1
# Don't get used!
#set adaCommentRegexp {/\*(([^*]/)|[^*]|\r)*\*/}
#set adaPreRegexp {^\#[\t ]*[a-z]*}
set adaKeyWords {
abort abs accept access all and array at begin body case constant
declare delay delta digits do else elsif end entry exception exit
for function generic goto others if in is limited loop mod new not
null of or subtype out package pragma private procedure raise range
record rem renames return reverse select separate task terminate
then type use when while with xor = /= := > < abstract aliased
protected requeue tagged until
}
regModeKeywords -e {--} -c magenta -k blue Ada $adaKeyWords -i ")" -i "(" -i ":" -i ";" -i "," -i "." -I blue
proc dummyAda {} {}
#===============================================================================
# From Tom Konantz
#===============================================================================
proc AdaMarkFile {} {
global AdamodeVars
set pos 0
while {![catch {search -s -f 1 -r 1 -m 0 -i 1 $AdamodeVars(funcExpr) $pos} res]} {
set start [lindex $res 0]
set end [expr [lindex $res 1] + 1]
set text [getText $start $end]
if {[regexp -nocase -indices {(procedure|function)[ \t]+([a-zA-Z0-9_]+)} $text dummy dummy0 pname]} {
set i1 [expr [lindex $pname 0] + $start]
set i2 [expr [lindex $pname 1] + $start + 1]
set word [getText $i1 $i2]
set tmp [concat $i1 $i2]
if {[info exists cnts($word)]} {
# This section handles duplicate. i.e., overloaded names
set cnts($word) [expr $cnts($word) + 1]
set ol_word [ join [concat $word "#" $cnts($word)] ""]
set inds($ol_word) $tmp
} else {
set cnts($word) 1
set inds($word) $tmp
}
}
set pos $end
}
if {[info exists inds]} {
foreach f [lsort -ignore [array names inds]] {
set res $inds($f)
setNamedMark $f [lineStart [lindex $res 0]] [lindex $res 0] [lindex $res 1]
}
}
}
# the following will switch between the Ada spec & body,
# assuming they're in the same directory
# and use either GNAT or VAX Ada naming conventions.
# other conventions can be supported fairly easily.
proc otherPart {} {
global winActive
set curname [lindex $winActive 0]
if {[regsub "(.*)\.ads" $curname {\1.adb} tgtname]} {
openFileQuietly $tgtname
} elseif {[regsub "(.*)\.adb" $curname {\1.ads} tgtname]} {
openFileQuietly $tgtname
# Next clause must precede the one after it!
} elseif {[regsub {(.*)_\.a$} $curname {\1.a} tgtname]} {
openFileQuietly $tgtname
} elseif {[regsub {(.*)\.a$} $curname {\1_.a} tgtname]} {
openFileQuietly $tgtname
} else {
error "NoMatch"
}
}
bind f9 otherPart Ada